package com.zxt.dental_sys.Config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class StaticConfig implements WebMvcConfigurer {
    // 图片访问 虚拟路径配置
    @Value("${img.store}")
    private String imgStore;

    // 图片访问 虚拟路径配置
    @Value("${resource.store}")
    private String resourceStore;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/img/**")
                .addResourceLocations(imgStore);
        registry.addResourceHandler("/resource/**")
                .addResourceLocations(resourceStore);
    }
}
